package tests;


import heap.*;
import global.*;
import bufmgr.*;
import diskmgr.*;
import index.*;
import iterator.ColumnarDupliElim;

import java.lang.*;
import java.io.*;

import columnar.ColumnarFileInfo;
import columnar.Columnarfile;


public class ColumnarDupliElimTest {
	private static String columnDbName;
	private static String columnarFileName;
	private static String numBuf;
	private static AttrType[] types;
	private static Columnarfile f=null;
	private static String[] colNames=null;
	
	public static void main(String args[])
	{
		//The main function will take in the Database name and call the DupliElim Function
	//	System.out.println("PROGRAM STARTED!!");
	  columnDbName= args[1];
	  columnarFileName= args[2];
	  numBuf=args[3];
	  types = new AttrType[4];
		types[0] = new AttrType(AttrType.attrString);
		types[1] = new AttrType(AttrType.attrString);
		types[2] = new AttrType(AttrType.attrInteger);
		types[3] = new AttrType(AttrType.attrInteger);
	  
	 SystemDefs sysdef = new SystemDefs(columnDbName,100000,100,"Clock");
		
	
	//ColumnarFileInfo cInfo = new  ColumnarFileInfo(columnarFileName+".hdr",4);
	f=new Columnarfile(columnarFileName, 4, types);
	
	
	ColumnarFileInfo cInfo= f.getColumnarFileInfo(columnarFileName+".hdr");
	System.out.println("IN TEST FILE....."+f.heapFileNames[0]+" "+f.getnumColumns());
//	colNames = cInfo.getColumnNames();
	
//	System.out.println(colNames[0]);
		short[] str_size=new short[1];
		str_size[0]=60;
		
	//System.out.println("Opening Constructor!! ");
		ColumnarDupliElim cde = new ColumnarDupliElim (types,
				(short)f.getnumColumns(),
				str_size,
				columnarFileName,
				Integer.parseInt(numBuf),
				false);
		System.out.println("Calling function!!!");		
		Tuple []Duplicate=null;
		System.out.println("The duplicate tuples are as follows..");
		cde.ElimDupl();
		
		/*
		for(Tuple tup:Duplicate)
		{
			System.out.println(tup.toString());
			
			
		}*/
		
	}

}
